#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[500001],b[500001];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[x]++;
        b[x]++;
        m=max(x,m);
    }
    int i=1,j=2;
    while(i<=m&&j<=m)
    {
        while(b[i]>0)
        {
            j=i+1;
            while(a[j]==0&&j<=m)
                j++;
            if(j>m)
                break;
            if(j>i&&i<=m&&j<=m)
            {
                a[i]--;
                a[j]--;
                b[i]--;
            }
        }
        i++;
    }
    int s=0;
    for(int i=1;i<=m;i++)
    {
        s+=b[i];
    }
    cout<<s;
}
//cout<<"*"<<i<<endl;
